//
//  main.m
//  作业8
//
//  Created by dllo on 16/7/13.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Animal.h"
#import "Cat.h"
#import "DreamSpace.h"
#import "NSMutableArray+ConvertArray.h"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // NB性
        Animal *animal = [[Animal alloc] init];
        animal.name = @"朱主爱";
//        animal setName:<#(NSString * _Nonnull)#>
        animal.sex = @"";
//        animal setSex:(NSString * _Nullable)
        [animal setFriends:@[@"小狗", @"小猫", @"男人"]];
//        animal setFriends:<#(NSArray * _Nullable)#>
        [animal friends];
//        animal (NSArray * _Nonull)friends
        [animal setFriends:nil];
        [animal friends];
        // 泛型性
        // 数组
        NSMutableArray *array = [NSMutableArray arrayWithObjects:@"a", @"b", @"c", @"d",@10, nil];
//        array addObject:<#(nonnull id)#>
//        array.(id _Nullable)firstObject
        NSMutableArray<NSString *> *withStrArray = [NSMutableArray arrayWithObjects:@10, @"a", @"b", nil];
//        withStrArray addObject:<#(nonnull NSString *)#>
//        withStrArray.(NSString * _Nullable)firstObject
        // 字典

        NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"王尼玛", @"name", nil];
//        [dic objectForKey:<#(nonnull id)#>]
        NSMutableDictionary<NSString *,NSString * > *withStringDic = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"鲁尼美", @"friend", nil];
//        [withStringDic objectForKey:<#(nonnull NSString *)#>]
       
        // 对象(自定义泛型)
        DreamSpace *dreamSpace = [[DreamSpace alloc] init];
//        dreamSpace addObject:<#(id)#>
        DreamSpace<Cat *> *catDreamSpace = [[DreamSpace alloc] init];
        Cat *cat = [[Cat alloc] init];
     
//        catDreamSpace addObject:<#(Cat *)#>
        [catDreamSpace addObject:cat];

        
        DreamSpace<Animal *> *animalDreamSpace = [[DreamSpace alloc] init];
//        animalDreamSpace addObject:<#(Animal *)#>
        [animalDreamSpace addObject:animal];
        [animalDreamSpace addObject:cat];
        
        DreamSpace *dreamSpace1 = [[DreamSpace alloc] init];

        
//        NSArray *arr1 = (NSArray *)[dreamSpace1 returnArray];
        NSArray *arr = [dreamSpace1 returnArray];
        
        
        NSMutableArray *mutableArray = [NSMutableArray arrayWithObjects:@"10", @"12", @"5", @"3", @"27", nil];
        [mutableArray convert];
        [mutableArray sayHello];
       
        NSLog(@"%@", [mutableArray convert]);

    }
    return 0;
}
